package com.example.blog.common;

import java.util.HashMap;

/**
 * @Question AjaxResult
 * @Date 2023/1/6 16:03
 * @Solution
 */
public class AjaxResult {
    public static HashMap<String,Object> success(Object data) {
        HashMap<String,Object> result=new HashMap<>();
        result.put("code",200);
        result.put("msg","");
        result.put("data",data);
        return result;
    }
    public static HashMap<String,Object> success(String msg,Object data) {
        HashMap<String,Object> result=new HashMap<>();
        result.put("code",200);
        result.put("msg",msg);
        result.put("data",data);
        return result;
    }
    public static HashMap<String,Object> fail(int code,String msg) {
        HashMap<String,Object> result=new HashMap<>();
        result.put("code",code);
        result.put("msg",msg);
        result.put("data","");
        return result;
    }
}
